package com.zhp.web;

import com.zhp.pojo.HUserinfo;
import com.zhp.service.UserService;
import com.zhp.service.impl.UserServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @date 2023/4/12
 * @desc
 */
@WebServlet("/showDoctor")
public class ShowDoctorServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doPost(req,resp);
    }


    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //科室id
        String tid = req.getParameter("tid");
        //根据科室id 查询 该科室下的医生信息
        UserService userService = new UserServiceImpl();
        List<HUserinfo> list =  userService.findUserByKsid(tid);
        req.setAttribute("uis",list);
        req.getRequestDispatcher("/sd.jsp").forward(req,resp);
    }
}
